<template>
  <div class="tab">
    <el-tabs v-model="activeName" @tab-click="tabChange">
      <el-tab-pane
        v-for="item in paneRules"
        :key="item.name"
        :name="item.name"
        :label="item.label"
      >
        <el-button :disabled="isdisable" type="primary" @click="handleAddClick"
          >添加</el-button
        >
        <Table v-bind="$attrs" @editClick="handleClick"></Table>
      </el-tab-pane>
    </el-tabs>
  </div>
</template>

<script>
import Table from "@/views/home/category/children/Table";
export default {
  name: "Tab",
  props: {
    paneRules: {
      type: Array,
      default() {
        return [];
      }
    }
  },
  inheritAttrs: false,
  methods: {
    tabChange() {
      this.$emit("tabChange");
    },
    handleAddClick() {
      this.$emit("handleTabAddClick");
    },
    handleClick(param) {
      this.$emit("editClick", param);
    }
  },
  data() {
    return {
      activeName: "only",
      isdisable: true
    };
  },
  components: {
    Table
  }
};
</script>

<style lang="scss" scoped></style>
